package other;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderStroke;
import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.BorderWidths;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import javafx.stage.Stage;

// 设置样式
public class BorderDemo extends Application {
	private StackPane root = new StackPane();
	private Button button;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		button = new Button("click me");
		button.setFont(Font.font("KaiTi", 30));
		button.setStyle("-fx-border-color: #B4EEB4; -fx-border-style: dotted; -fx-border-width: 5; -fx-border-radius: 0");
		root.getChildren().add(button);
		
		// 设置边界(属性分别为颜色,边界类型(虚线,点缀,实线),圆角半径,宽度)
		BorderStroke bStroke = new BorderStroke(Paint.valueOf("#B4EEB4"), BorderStrokeStyle.DOTTED, new CornerRadii(20), new BorderWidths(5));
		Border border = new Border(bStroke);
		button.setBorder(border);
		
		Scene scene = new Scene(root, 300, 250);
		stage.setScene(scene);
		stage.show();
	}
}
